<!DOCTYPE html>
<html lang="en">

	<head>
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
		<meta name="description" content="">
		<meta name="author" content="">
		<!-- STYLESHEETS -->
		<!--[if lt IE 9]><script src="../../js/flot/excanvas.min.js"></script><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script><![endif]-->
		<link rel="stylesheet" type="text/css" href="../../css/cloud-admin.css">
		<link rel="stylesheet" type="text/css" href="../../css/themes/default.css" id="skin-switcher">
		<link rel="stylesheet" type="text/css" href="../../css/responsive.css">
				<link href="../../font-awesome/css/font-awesome.min.css" rel="stylesheet">
		<!-- file-input -->
		<link rel="stylesheet" type="text/css" href="../../js/file-input/fileinput.css" />
		<!-- datatable -->
		<link rel="stylesheet" href="../../js/datatables/datatable.css">
		<!-- WIZARD -->
		<link rel="stylesheet" type="text/css" href="../../js/bootstrap-wizard/wizard.css" />

	</head>

	<body>
		<header class="navbar clearfix" id="header">
		</header>

		<!-- PAGE -->
		<section id="page">
			<!-- SIDEBAR -->
			<div id="sidebar" class="sidebar">
			<div class="sidebar-menu nav-collapse">
						
						<!-- SIDEBAR MENU -->
						<ul>							
							
							
						</ul>
						<!-- /SIDEBAR MENU -->
					</div>

			</div>
			<!-- /SIDEBAR -->
			<div id="main-content">

				<div class="container">
					<div class="row">
						<div id="content" class="col-lg-12">
							<!-- PAGE HEADER-->
							<div class="row">
								<div class="col-sm-12">
									<div class="page-header">
										<!-- STYLER -->

										<!-- /STYLER -->
										<!-- BREADCRUMBS -->
										<ul class="breadcrumb">
											<li>
												<i class="fa fa-home"></i>
												<a href="index.html">首页</a>
											</li>
											<li>
												<a href="#">订单管理</a>
											</li>
											<li>订单详情</li>
										</ul>
										<!-- /BREADCRUMBS -->

									</div>
								</div>
							</div>
							<!-- /PAGE HEADER -->
							<!-- SAMPLE -->

							<div class="row">
								<div class="col-md-12" style="background-color:#ffffff">
									<div class="box" style="margin-top:10px">
										<div class="box-title" style="border-bottom:1px solid #5e87b0;line-height:38px">
											<h4><i class="fa fa-file" style="color:red"></i>订单信息</h4>
											<a class="btn btn-default" href="order_list.html" style="float:right">返回订单列表</a>
										</div>
										<div class="box-body">
											<div class="form-group  mrg-bt10">
												<label class="control-label col-md-2 " style="width:100px">订单编号：</label>
												<div class="col-md-2 inline" id="orderId">
												</div>
												<label class="control-label col-md-2 " style="width:100px">订单状态：</label>
												<div class="col-md-2 inline" id="orderStatus">
												</div>
												<label class="control-label col-md-2 " style="width:100px">下单时间：</label>
												<div class="col-md-2 inline" id="createTime">
												</div>
											</div>
											<div class="form-group  mrg-bt10 cancel" style="display:none">
												<label class="control-label col-md-2 " style="width:100px">关闭时间：</label>
												<div class="col-md-2 inline" id="cancelTime">
												</div>
												<label class="control-label col-md-2 " style="width:100px">关闭原因：</label>
												<div class="col-md-4 inline" id="cancelReason">
												</div>
												
											</div>
										</div>
									</div>
									<div class="box">
										<div class="box-title" style="border-bottom:1px solid #5e87b0">
											<h4><i class="fa fa-user" style="color:#eea236"></i>收货信息</h4>
										</div>
										<div class="box-body">
											<div class="form-group mrg-bt10">
												<label class="control-label col-md-2" style="width:100px">收货人：</label>
												<div class="col-md-2 inline" id="receiver">
												</div>
												<label class="control-label col-md-2" style="width:100px">电话：</label>
												<div class="col-md-2 inline" id="telPhone">
												</div>
												<label class="control-label col-md-2" style="width:100px">地址：</label>
												<div class="col-md-3 inline" id="address">
												</div>
											</div>
											
										</div>
									</div>
									<div class="box">
										<div class="box-title" style="border-bottom:1px solid #5e87b0">
											<h4><i class="fa fa-rmb" style="color:#9db36a"></i>支付信息</h4>
										</div>
										<div class="box-body">
											<div class="form-group  mrg-bt10">
												<label class="control-label col-md-2" style="width:100px">支付方式：</label>
												<div class="col-md-2 inline" id="payType">
												</div>
												
												<label class="control-label col-md-2" style="width:100px">支付金额：</label>
												<div class="col-md-2 inline" id="paidPrice">
												</div>
												<label class="control-label col-md-2" style="width:130px">商家订单号：</label>
												<div class="col-md-2 inline" id="orderPayCode">
												</div>
												
												
											</div>
											<div class="form-group  mrg-bt10">	
											<label class="control-label col-md-2" style="width:130px">新客优惠：</label>
												<div class="col-md-2 inline" id="newCustomPrice" style="width:130px">
												</div>								
												<label class="control-label col-md-2" style="width:120px">N元任选优惠：</label>
												<div class="col-md-2 inline" id="packPrice" style="width:130px">
												</div>
												<label class="control-label col-md-2" style="width:80px">满减：</label>
												<div class="col-md-2 inline" id="manjianPrice" style="width:130px">
												</div>
												<label class="control-label col-md-2" style="width:130px">优惠券：</label>
												<div class="col-md-2 inline" id="youhuijuanPrice" style="width:130px">
												</div>
											</div>

										</div>
									</div>
									<div class="box">
										<div class="box-title" style="border-bottom:1px solid #5e87b0">
											<h4><i class="fa fa-truck" style="color:#d9edf7"></i>物流信息</h4>
										</div>
										<div class="box-body logisticsList">
											<div class="form-group  mrg-bt10 ">
												<label class="control-label col-md-2" style="width:100px">物流公司：</label>
												<div class="col-md-2 inline" id="expressCompany">
												</div>
												<label class="control-label col-md-2" style="width:100px">物流单号：</label>
												<div class="col-md-2 inline" id="expressCode">
												</div>
												
											</div>
										</div>
									</div>
									<div class="box">
										<div class="box-title" style="border-bottom:1px solid #5e87b0">
											<h4><i class="fa fa-archive" style="color:#468847"></i>商品信息</h4>
										</div>
										<div class="box-body">
											<div class="form-group" style="height:auto;">
												<table id="sku_list" class="table table-bordered">
													<thead>
													<tr>
														<th>商品名称</th>
														<th>SKU编码</th>
														<th>颜色/规格</th>
														<th>尺码</th>
														<th>单价</th>
														<th>数量</th>
														<th>小计</th>
														<th>销售类型</th>
														</tr>
													</thead>
													<tbody>														
													</tbody>
												</table>
											</div>
										</div>
									</div>
									<div class="box">
									  <div class="form-group" style="text-align: right;color:red">
									  <h4>
									    <span id="totalPrice"></span>
									    </h4>
									  </div>
									</div>
								</div>
							</div>

							<!-- /SAMPLE -->

							<div class="footer-tools">
								<span class="go-top">
								<i class="fa fa-chevron-up"></i> Top
							</span>
							</div>
						</div>
						<!-- /CONTENT-->
					</div>
				</div>
			</div>
		</section>
		<!--/PAGE -->
		<!-- JAVASCRIPTS -->
		<!-- Placed at the end of the document so the pages load faster -->
		<!-- JQUERY -->
		<script src="../../js/jquery/jquery-2.0.3.min.js"></script>

		<!-- BOOTSTRAP -->
		<script src="../../bootstrap-dist/js/bootstrap.min.js"></script>
		<!-- COOKIE -->
		<script type="text/javascript" src="../../js/jQuery-Cookie/jquery.cookie.min.js"></script>
		<!-- CUSTOM SCRIPT -->
		<script src="../../js/script.js"></script>
		<script src="../../js/common.js"></script>

		<script>
			var AddDetail = function() {
			    var getStatusDesc=function(orderStatus){
			       var str="";
								   switch(orderStatus){
								     case "TradeClosed":str="交易关闭";break;
								     case "WaitingPay":str="待付款";break;
								     case "WaitingCheck":str="待审核";break;
								     case "WaitingSend":str="待发货";break;
								     case "WaitingSign":str="待签收";break;
								     case "TradeSuccess":str="交易成功";break;
								   }
								   return str;
				};
				
				var getDetail = function(orderId) {
					$.ajax({
						type: "get",
						url: App.getContextPath() + "admin/order/orderDetail.do",
						data: {
							orderId: orderId
						},
						async: true,
						success: function(result) {
						if(result!=null){
						   $("#orderId").html(result.orderId);
						   $("#orderStatus").html(getStatusDesc(result.orderStatus));
						   $("#createTime").html($.getLocalTime(result.createTime));
						   $("#receiver").html(result.receiver);
						   $("#telPhone").html(result.telPhone);
						   $("#address").html(result.provinceName+result.cityName+result.areaName+result.address);
						   $("#payType").html(result.payType=="WeChat"?"微信支付":"支付宝支付");
						   $("#paidPrice").html(format_thousands(result.paidPrice));
						   $("#expressCompany").html(result.expressCompany);
						   $("#expressCode").html(result.expressCode);
						   $("#sendTime").html(result.sendTime==null?"":$.getLocalTime(result.sendTime));
						   $("#youhuijuanPrice").html(format_thousands(result.youhuijuanPrice));
						   $("#manjianPrice").html(format_thousands(result.manjianPrice));
						   $("#newCustomPrice").html(format_thousands(result.newCustomDisPrice));
						   $("#packPrice").html(format_thousands(result.packDisPrice));
						   $("#orderPayCode").html(result.orderPayCode);
						   
						   if(result.orderStatus=="TradeClosed"){
						   	$(".cancel").show();
						   	$("#cancelTime").html($.getLocalTime(result.cancelTime));
						   	$("#cancelReason").html(result.cancelReason);
						   }
						   $("#totalPrice").html("商品金额："+format_thousands(result.productPrice)+"-优惠："+format_thousands(result.newCustomDisPrice+result.packDisPrice)+"-满减："+format_thousands(result.manjianPrice)+"-优惠劵："+format_thousands(result.youhuijuanPrice)+"+运费："+format_thousands(result.expressPrice)+"=总金额："+format_thousands(result.totalPrice));
						   
						   $.each(result.orderDetail,function(index,item){
						   var actionType="普通商品";
						   if(item.promotionType=="JiaJiaGou")
						   		actionType="加价购";
						   if(item.promotionType=="ManZeng")
						   		actionType="满赠";
						     var tr="<tr><td>"+item.productName+"</td><td>"+item.skuCode+"</td><td>"+item.shortName+"</td><td>"+item.size+"</td><td>"+format_thousands(item.salePrice)+"</td><td>"+item.quantity+"</td><td>"+format_thousands(item.salePrice*item.quantity)+"</td><td>"+actionType+"</td></tr>";
						     $("#sku_list tbody").append(tr);
						   
						   });
						   //循环物流
						   var str="";
						   if(result.logisticsList!=null){
							   $.each(result.logisticsList,function(index,m){
								   str+='<div class="form-group  mrg-bt10 "><label class="control-label col-md-2" style="width:100px">物流公司：</label>'+
									    '<div class="col-md-2 inline" >'+m.expressCompany+
									    '</div>'+
									    '<label class="control-label col-md-2" style="width:100px">物流单号：</label>'+
									'<div class="col-md-2 inline" >'+m.expressCode+
									'</div><label class="control-label col-md-2" style="width:100px">发货时间：</label>'+
									'<div class="col-md-2 inline" >'+$.getLocalTime(m.sendTime)+
									'</div></div>';
									
							   });
							   $(".logisticsList").empty().append(str);
						   }else{
							   $(".logisticsList").parent().hide();
						   }
						  }
						}
					});
				};
				return {
					init: function() {
						App.init();
						var id=$.getUrlParam("id");
						getDetail(id);
					}
				}
			}();
			$(function() {
				$("#header").load("../head.html");
				///$("#sidebar").load("../menu.html");
				AddDetail.init();
			});
		</script>

		<!-- /JAVASCRIPTS -->
	</body>

</html>